package com.xiaohui.user.event;


import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.event.TransactionalEventListener;

@Slf4j
@Service
public class PersonEventListener {

    @TransactionalEventListener(fallbackExecution = true)
    public void listenSecKillCreateEvent(PersonChangeEvent event) {
        switch (event.getType()) {
            case "create":
                log.info("执行创建相关事件,person：{}", JSON.toJSONString(event.getPerson()));
                break;
            default:
                break;

        }
    }
}
